package com.ruoyi.web.controller.my;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MyForum;
import com.ruoyi.system.service.IMyForumService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 论坛Controller
 * 
 * @author ruoyi
 * @date 2023-11-21
 */
@RestController
@RequestMapping("/system/forum")
public class MyForumController extends BaseController
{
    @Autowired
    private IMyForumService myForumService;

    /**
     * 查询论坛列表
     */
    @PreAuthorize("@ss.hasPermi('system:forum:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyForum myForum)
    {
        startPage();
        List<MyForum> list = myForumService.selectMyForumList(myForum);
        return getDataTable(list);
    }

    /**
     * 获取论坛详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:forum:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(myForumService.selectMyForumById(id));
    }

    /**
     * 删除论坛
     */
    @PreAuthorize("@ss.hasPermi('system:forum:remove')")
    @Log(title = "论坛", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(myForumService.deleteMyForumById(id));
    }
}
